package com.itheima_4;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class RFilectDemo1 {
    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        InputStream is = systemClassLoader.getResourceAsStream("prop.properties");
        Properties prop=new Properties();
        prop.load(is);
        is.close();
        Class aClass = Class.forName(prop.getProperty("className"));
        Constructor constructor = aClass.getConstructor();
        Student o = (Student) constructor.newInstance();
        Method declaredMethod = aClass.getDeclaredMethod(prop.getProperty("methodName"));
        declaredMethod.setAccessible(true);
        Object invoke = declaredMethod.invoke(o);

    }
}
